package com.torry.edss.integration.feign.eastmoney;

import com.torry.edss.integration.feign.eastmoney.response.EMStockCategoryResponse;
import feign.Headers;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author Administrator
 */
@FeignClient(name = "eastMoneyDataCenterFeignClient", url = "https://datacenter.eastmoney.com")
public interface EastMoneyDataCenterFeignClient {


    /**
     * 历史股东数据。 按照时间正序
     *
     * @param widthSuffixCode
     * @return
     */
    @GetMapping("/securities/api/data/v1/get?" +
            "reportName=RPT_F10_EH_HOLDERNUM" +
            "&columns=SECUCODE%2CSECURITY_CODE%2CEND_DATE%2CHOLDER_TOTAL_NUM%2CTOTAL_NUM_RATIO%2CAVG_FREE_SHARES%2CAVG_FREESHARES_RATIO%2CHOLD_FOCUS%2CPRICE%2CAVG_HOLD_AMT%2CHOLD_RATIO_TOTAL%2CFREEHOLD_RATIO_TOTAL" +
            "&quoteColumns=" +
            "&filter=(SECUCODE%3D%22{code}%22)" +
            "&pageNumber=1" +
            "&pageSize=9999" +
            "&sortTypes=1" +
            "&sortColumns=END_DATE")
    @Headers({"Content-Type: application/json"})
    String getHisShareholderInfos(@PathVariable(name = "code") String widthSuffixCode);


    @GetMapping("securities/api/data/get?" +
            "type=RPT_F10_CORETHEME_BOARDTYPE" +
            "&sty=SECUCODE,SECURITY_CODE,SECURITY_NAME_ABBR,BOARD_CODE,BOARD_NAME,IS_PRECISE,BOARD_RANK,BOARD_TYPE" +
            "&filter=(SECUCODE=\"{widthSuffixCode}\")" +
            "&p=1" +
            "&ps=" +
            "&sr=1" +
            "&st=BOARD_RANK" +
            "&source=HSF10")
    @Headers({"Content-Type: application/json"})
    EMStockCategoryResponse fetchStockCategories(@PathVariable(name = "widthSuffixCode") String widthSuffixCode);

}